<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<!DOCTYPE HTML>
<html>
  <head>
    
    <title>商品出货单管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    	
	
	<link href="<%=basePath %>/background/css/layout.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath %>/background/css/header.css" rel="stylesheet" type="text/css" />

	<link href="<%=basePath %>/warehouse/css/button.css" rel="stylesheet" type="text/css" />

	
	
  </head>
  <script>
 
	

	
	</script>
  <body>

<div id="container">
  <div id="header">
		 <jsp:include page="/background/head.jsp"></jsp:include>
	</div>
  <div id="applicationbar">
		 <jsp:include page="/background/app/appbar.jsp"></jsp:include>
	</div>
  <div id="mainContent"> 
    <div id="sidebar">

		<jsp:include page="/background/left.jsp"></jsp:include>
	</div>
	
	
	
    <div id="content" >
    
	
	
	
	 <div style="border:1px solid #ffffff; border-top-color:#6cb1f1; background-color: #e5f3ff; width: 100%; top: 0px;" >
							查找出货信息 
     			<input   class="small button orange" style="bottom: 1px;" type="button" value="查看谁有权限" 
     				onclick="javascript:openUrlForDialog('selectoperatorlimitedAction_background.action?limitedCode=<s:property value="limitedcode"/>')"/>
     				 
     				
     				<a href="<%=basePath %>/warehouse/flow/searchcnofirmshippriceflowbyshipno.jsp">录入快递单</a>
     				
     			<a href="managereceiptlist_warehouse.action?flowCode=FLOW.WAREHOUSE.RECEIPTLIST.START">已打完出仓单:<s:property value="flowWarehouseStartNum"/></a>
     				
     				<a href="managereceiptlist_warehouse.action?flowCode=FLOW.WAREHOUSE.RECEIPTLIST.CONFIRM">确认出仓:<s:property value="flowWarehouseConfirmNum"/></a>
     				
     				<a href="managereceiptlist_warehouse.action?flowCode=FLOW.WAREHOUSE.RECEIPTLIST.CANCEL">取消流程:<s:property value="flowWarehouseCancelNum"/></a>
     				
     				<a href="managereceiptlist_warehouse.action?flowCode=FLOW.WAREHOUSE.RECEIPTLIST.DOESCONFIRMSHIPPRICE">等待确认邮费:<s:property value="flowWarehouseDoesconfirmshippriceNum"/></a>
     				
     				<a href="managereceiptlist_warehouse.action?flowCode=FLOW.WAREHOUSE.RECEIPTLIST.DOESNOTPAY">等待同行收款:<s:property value="flowWarehouseDoesnotpayNum"/></a>
     				
		<div style="float: right;">
			<a href="preaddreceiptlist_warehouse.action">出货</a> 
     		</div>
		</div>
		
		 <div style=" height: 25px;margin: 15px;">
		
		<s:fielderror id="errormessage" />
		
	    	 <form id="managereceiptlist_warehouse" name="managereceiptlist_warehouse" onSubmit="return true;" action="managereceiptlist_warehouse.action" method="POST" >
    	
			
					  查找出货信息: <input class="searchtxt" type="text" name="searchStr" size="30" value="<s:property value="searchStr"/>" autofocus="autofocus"/>
					  <input class="large button blue" style="bottom:6px;" type="submit" value="查找"/> 
				</form>
		</div>
	
		<div style="width: 100%;padding:0px;float:left;">
			<div style="border:1px solid #ffffff; border-top-color:#6cb1f1; background-color: #e5f3ff;width:100%; top: 0px;">
				出货单列表  <a href="#">今天出仓单数:<s:property value="dayCount"/> 销售总额:<s:property value="dayTotal"/></a>
     			
     			 <a href="<%=basePath %>/warehouse/managereceipt_warehouse.action">出仓按产品查询 </a>
			</div>
			
			<div>
				<table >
				<tbody>
					<tr>
						
							<td style="border-bottom:#e5f3ff solid 1px;" width="515" align="center">产品</td>
							
							<td style="border-bottom:#e5f3ff solid 1px;" width="105" align="center">总价(元)</td>
							<td style="border-bottom:#e5f3ff solid 1px;" width="105" align="center">用户ID</td>
							<td style="border-bottom:#e5f3ff solid 1px;" width="115" align="center">流程状态</td>
					
							<td style="border-bottom:#e5f3ff solid 1px;" width="115" align="center">操作人</td>
		
						</tr></tbody>
				</table>
			</div>
			<div>
			
		<table width="100%">
			<s:iterator id="receiptlistList" value="receiptlistList">
				<tr>

						<td>
							<table border="0" cellpadding="0"  cellspacing="0" width="100%"  style= "border:1px solid #ffffff; border-bottom-color:#b2d5ff;
    border-left-color:#b2d5ff;border-right-color:#b2d5ff;border-top-color:#b2d5ff">
									<tr>
										<td>
											<table bgcolor="#f3f7fc" width="100%">
												<tr>
													<td width="360">
													<s:if test="#receiptlistList.state_receiptlist == 9">
														<s>出单号:</s><a href="receiptlistinfo_warehouse.action?id=<s:property value="#receiptlistList.id_receiptlist"/>" title="<s:property value="#receiptlistList.department_receiptlist"/>"><s:property value="#receiptlistList.id_receiptlist"/></a>
														</s:if>
					
															<s:else>
															
															出单号:<a href="receiptlistinfo_warehouse.action?id=<s:property value="#receiptlistList.id_receiptlist"/>" title="<s:property value="#receiptlistList.department_receiptlist"/>"><s:property value="#receiptlistList.id_receiptlist"/></a>
														
															</s:else>
															<font color="#cccccc">快递单号:<s:property value="#receiptlistList.shipno_receiptlist"/>
															<s:if test="#receiptlistList.realshipprice_receiptlist != 0">
																(费用:<s:property value="#receiptlistList.realshipprice_receiptlist"/>)
															</s:if>
															
															<s:if test="#receiptlistList.profit_receiptlist != 0">
																<font color="red">利润:<s:property value="#receiptlistList.profit_receiptlist"/></font>
															</s:if>
															</font>
													<td>
													
													</td>
													<td align="right">
														出单时间:<s:property value="#receiptlistList.date_receiptlist"/>
														<s:if test="#receiptlistList.remark_receiptlist!=''">
															<a href="javascript:openUrlForDialog('premodifyreceiptlistremark_warehouse.action?id=<s:property value="#receiptlistList.id_receiptlist"/>');"><img style="border: 0;" alt="" title="<s:property value="#receiptlistList.remark_receiptlist"/>" src="/warehouse/icon/15/redflag.png"/></a>
														</s:if>
														<s:else>
															<a href="javascript:openUrlForDialog('premodifyreceiptlistremark_warehouse.action?id=<s:property value="#receiptlistList.id_receiptlist"/>');"><img style="border: 0;" alt="" src="/warehouse/icon/15/grayflag.png"/></a>
														</s:else>
														
														
													</td>
													
												 	
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<table border="1" cellpadding="0" width="100%"  cellspacing="0" bordercolor="#f5f5f5" style="border-collapse:collapse; border-width:1px 0 0 1px;">
												<tr>
													<td width="515" >
													
													
													
													<s:iterator id="receiptList" value="receiptListMap.get(#receiptlistList.id_receiptlist)">
														<table width="100%">
															<tr>
																<td width="105">
																 	
																	
																</td>
																<td width="62">
																 	<img alt="" src="<s:property value="#receiptList.image_receipt"/>" width="60" height="60"/>
																	
																</td>
																<td width="243">
																
																<a href="#">
																<s:property value="#receiptList.goodsname_receipt"/>
																</a>
																</td>
																
																<td width="105" align="center" >
																
																
																
																<s:if test="#receiptList.number_receipt > 1">
																<font color="red">
																
																(<s:property value="#receiptList.number_receipt"/>件)
																</font>
																</s:if>
																<s:else>
																
																(<s:property value="#receiptList.number_receipt"/>件)
																
																</s:else>
																</td>
															</tr>
															
														</table>
													</s:iterator>
													
														
													</td>
													
													<td align="center" width="105">
														<s:property value="#receiptlistList.total_receiptlist"/></br>
														<font color="#cococo">(快递:<s:property value="#receiptlistList.shipprice_receiptlist"/>)</font>
													</td>
													
													<td width="105" align="center" title="<s:property value="#receiptlistList.customerinfo_receiptlist"/>">
														<a target="_blank" href="managereceiptlist_warehouse.action?searchStr=<s:property value="#receiptlistList.customerid_receiptlist"/>"><s:property value="#receiptlistList.customerid_receiptlist"/></a>
														
													</td>
													 
													<td width="155" align="center" title="<s:property value="flowRecordlistMap.get(#receiptlistList.id_receiptlist).username_recordlist"/>">
														
														<s:property value="flowRecordlistMap.get(#receiptlistList.id_receiptlist).cnname_recordlist"/> 
															<br/>
															<button class="large button orange"  onclick="openUrlForDialog('<%=basePath %>/flow/enterflow.action?kind=FLOW.WAREHOUSE.RECEIPTLIST&kindid=<s:property value="#receiptlistList.id_receiptlist"/>')">
																查看流程
														</button>
														
													
													</td>
													
													<td align="center" width="105">
													
															
														<s:property value="#receiptlistList.username_receiptlist"/>
														
														</br>
														<s:if test="#session.operatorInfo.email_operator == #receiptlistList.useremail_receiptlist">
															
															<s:if test="#receiptlistList.state_receiptlist == 0">
															<a href="javascript:del('<s:property value="#receiptlistList.customerid_receiptlist"/>',<s:property value="#receiptlistList.id_receiptlist"/>)"> 取消此订单 </a>
															</s:if>
														</s:if>
													
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<s:if test="#receiptlistList.remark_receiptlist!=''">
									<tr>
										<td bgcolor="fff7d9">
										<table >
											<tr>
											<td bgcolor="fff7d9">
											备注：<s:property value="#receiptlistList.remark_receiptlist"/>
											
										</td>
										</tr>
										</table>
										
										</td>
									</tr>
									</s:if>
									
									
							</table>
						
						
						</td>
						
					
						
						
							
						
				</tr>
			</s:iterator>
		</table>
			</div>
			
			
			
		</div>
		<div >
		
			
						<%
						 String url = "managereceiptlist_warehouse.action";//*/
						 
						int pageSize = (Integer) request.getAttribute("pageSize");
						int beginPageNum =  (Integer) request.getAttribute("beginPageNum");
						int countRow =  (Integer) request.getAttribute("rowNum");
					    int countPage =(countRow-1)/pageSize+1;
					    int currentPage = countPage - (countRow-beginPageNum)/pageSize;
					   	String receiptInfo = (String)request.getAttribute("receiptInfo");//*/
					   	String flowCode = (String)request.getAttribute("flowCode");//*/
					   
					   
					    
					    String searchstr = (String)request.getParameter("searchStr");//*/
					    if(searchstr != null){
					    	searchstr = java.net.URLDecoder.decode(searchstr, "UTF-8");
					    	searchstr = java.net.URLEncoder.encode(searchstr,"UTF-8");
					    	searchstr = searchstr.replaceAll("%", "%25");
					    }else{
					    	searchstr = "";
					    }
					    
					    if((beginPageNum-pageSize+1) >= 1){%>
				    	<a href="<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&receiptInfo=<%=receiptInfo %>&beginPageNum=<%=(beginPageNum-pageSize) %>">
								上一页 </a>
				 	  <% }
					    
					    //beginPageNum =  (pageNum - 1) * pageSize;
						StringBuffer chagePageBuff = new StringBuffer();
						if(countPage >= 2){ 
							int begin = currentPage - 9;
							int end = currentPage + 9;
							
							if(begin < 1){
								begin = 0;
							}
							if(end > countPage){
								end = countPage-1;
							}
							
							
							for(int i=begin;i<countPage;i++){
								
								
								
								
								
								if(beginPageNum == i*pageSize){
									%>
									<%=i+1 %>
									<%
								}else{
									%>
									<a href="<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&receiptInfo=<%=receiptInfo %>&beginPageNum=<%=i*pageSize %>">
									[<%=i+1 %>] </a>
									<%
								}
								
								if(i > end){
									
									break;
									
								}
							}
						}
						
						if((beginPageNum+pageSize-countRow) < 0){%>
				    	<a href="<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&receiptInfo=<%=receiptInfo %>&beginPageNum=<%=(beginPageNum+pageSize) %>">
								下一页 </a>
				   		<% }
						if(countPage != 1){%>
			    		<input type="text" size="4" id="goPageNum" name="goPageNum"/> / <%=countPage %> <button onclick="gotoPage();">跳转</button>
				   		<% }
						//*/
						%>
					
		</div>
	
	</div>
	
	
  </div>
  
  <div id="footer">
<jsp:include page="/background/tail.jsp"></jsp:include>
	</div>
</div>





  </body>
<script type="text/javascript">

function del(name,id){
	if(confirm("取消  "+"出货单号:"+id+" 客户ID:\"" + name + "\"")){
		window.location.href='cancelreceiptlist_warehouse.action?id=' + id;
	}
}

function gotoPage(){
	countPage = <%=countPage %>;
	pageSize = <%=pageSize %>;
	pageNum = document.getElementById("goPageNum").value;

	pageNum = parseInt(pageNum);
	if(pageNum > countPage){
		pageNum = countPage;
	}
	beginPageNum = pageNum * pageSize - pageSize;
	if(beginPageNum < 0){
		beginPageNum = 0;

	}
	if(isNaN(beginPageNum)){
		beginPageNum = 0;
	}
	url = '<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&receiptInfo=<%=receiptInfo %>&beginPageNum=' + beginPageNum;
	//alert(url);
	window.location.href=url;
}
</script>


</html>
